<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('填写项目实际产值')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>


</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-actualvalue-edit">
        <input th:value="${obj.id}" id="id" name="id" class="form-control" type="hidden"/>

        <h4 class="form-header h4">项目基本信息</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label">工程公司名称：</label>
            <div class="col-sm-8">
                <input th:value="${obj.compName}" id="compName" name="compName" class="form-control" type="text"
                       disabled/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">项目名称：</label>
            <div class="col-sm-8">
                <input th:value="${obj.proName}" id="proName" name="proName" class="form-control" type="text" disabled/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">年份：</label>

            <div class="col-sm-8">
                <input th:value="${obj.year}" id="year" name="year" class="form-control" type="text" disabled/>
            </div>
        </div>
        <h4 class="form-header h4">填写月实际产值</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label">月度：</label>
            <div class="col-sm-8">
                <select name="month" id="month" class="form-control noselect2">
                    <option value="">请选择</option>
                    <option value="january">一月</option>
                    <option value="february">二月</option>
                    <option value="march">三月</option>
                    <option value="april">四月</option>
                    <option value="may">五月</option>
                    <option value="june">六月</option>
                    <option value="july">七月</option>
                    <option value="august">八月</option>
                    <option value="september">九月</option>
                    <option value="october">十月</option>
                    <option value="november">十一月</option>
                    <option value="december">十二月</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">实际产值<span style="color: red">(万元)</span>：</label>
            <div class="col-sm-8">
                <input id="value" name="value" class="form-control" type="text"/>
            </div>
        </div>

    </form>

</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: select2-js"/>
<script type="text/javascript">
    var prefix = ctx + "outPutValue";
    var data;
    $(function () {

    })

    function submitHandler() {
        data = {
            "id": $("#id").val(),
            "compName": $("#compName").val(),
            "proName": $("#proName").val(),
            "year": $("#year").val(),
            "value": $("#value").val(),
            "month": $("#month").val(),
        }
        if ($("#value").val() == "" || $("#month").val() == "") {
            alert("请选择月份或填写实际产值！");
        } else {

            $.ajax({
                url: prefix + '/findYearActualMonthCount',
                data: {
                    "id": $("#id").val(),
                    "year": $("#year").val(),
                    "month": $("#month").val(),
                },
                success: function (row) {
                    if (row.code == 0) {
                        $.operate.save(prefix + "/editActualValue", data);
                    } else {
                        alert(row.message);
                    }
                }
            })
        }
    }

</script>


</body>

</html>